package com.zysoft.function;

import android.app.Application;
import android.content.Context;
import android.os.Environment;
import android.os.StrictMode;
import android.util.Log;

import java.io.File;

/**
 * **************************************************************
 *
 * @ProjectName: hello
 * @Package: com.zysoft.function
 * @ClassName: MyApplication
 * @Description: MyApplication
 * @Author: wmf
 * @CreateDate: 2019/11/26 8:59
 * @UpdateDate: 2019/11/26 8:59
 * **************************************************************
 */
public class MyApplication extends Application {
    private static Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/log.log");
        if(file.exists()){
            Log.e("zysoft","删除");
            file.delete();
        }
        LogcatHelper.getInstance(this).start();
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        builder.detectFileUriExposure();
        context = getApplicationContext();
    }
    /**
     * 获取全局上下文*/
    public static Context getContext() {
        return context;
    }
}

